package Atop100.doubleZhiZhen;

//TODO:2023/9/22 移动0的个数
public class Class283 {
    //TODO:2023/9/22我自己写的不保证原顺序
    public void moveZeroes(int[] nums) {
        int left=0;
        int right= nums.length-1;
        while (left<right){
            while (nums[left]!=0){
                left++;
            }
            while (nums[right]==0){
                right--;
            }
            if (left>=right){
                break;
            }
            swap(nums,left,right);
        }

    }

    public  void swap(int[] p,int i,int j){


        int temp=p[i];p[i]=p[j];p[j]=temp;
    }




}
